The present invention generally relates to computer applications, and more particularly to the previewing and printing of computerized forms.
Present financial and business application programs are limited in the business forms that they can print. For example, such applications typically provide a limited number of invoices and/or billing statements that can be selected by a user. In general, the user selects an appropriate form such as an invoice or reminder, inputs some customer information, and prints the form for sending to a customer.
Although different kinds of businesses need different kinds of forms, the forms provided by current applications are not very flexible or customizable. For example, in one application program, hard-coded templates are provided, from which the user selects a form that is most appropriate for the user""s business. A slightly more customizable application program provides a dialog box for the user to choose the fields that the user wants to present in the business form. Although this enables some customization, the user is not permitted to edit or manipulate the fields that were chosen. Moreover, the user is unable to change colors or fonts, or remove or add text to the form.
However, one form is often more suitable than another for a particular business, even when considering only one type of business form. For example, a service business would not want the same type of invoice as a business that sold parts but provided no services, while yet another business would want to list both parts and labor on an invoice. Thus, although most businesses are dependent on the application program for its forms, the application program developers cannot foresee or efficiently provide enough varieties of forms to suit the many various types of businesses that exist.
A sophisticated user could, in theory, create customized forms or templates for use with these types of applications, but only if the user was familiar with the proper programming language and/or was capable of implementing that programming language to modify the selected form. For most businesses, a relatively advanced developer would be thus required for the creation of new or altered business forms. Most small businesses that use such an application program do not readily have access to such a skilled individual, and hiring one would be often cost prohibitive. Even if one or more skilled developers were available, however, the developers may have to perform a relatively major rewrite of the underlying code, depending on how the templates are filled in with customer data. In sum, business forms in financial and other business applications cannot be easily created, edited, and manipulated by a user or a third party.
Briefly, the present invention provides a method and system directed to the creation, editing and manipulation of customized pages for printout, especially business forms such as invoices and billing statements, and more particularly to the previewing and printing of such pages. An author creates a template in a straightforward manner by placing HTML (Hypertext Markup Language) and ActiveX/OLE components (client data controls) on a page to define a visual representation of that page. The client data controls may link to customer information maintained in a database. Via the controls, the system and method render a page with appropriate information, merging any data from a selected record (e.g., customer object) in the database into the template, such as to produce a business form that is both viewable and printable.
To accomplish the merging of arbitrary data with the template, a template data control is placed in the template to specify the type of database object that the template represents. To preview or print a page, a client (e.g., application) determines the location of a user-selected template, and creates an instance of an HTML renderer to load the template. Through an interface provided by the HTML renderer, the client control enumerates through the controls in the template to find the template data control by matching the data control""s Interface ID (IID). The data control invokes the other client data controls (e.g., list or static) on the page to render an image corresponding thereto, after loading any relevant data (fields) from a recordset in the database that correspond to the user/client-selected current object. As the data is retrieved, the controls draw representations of the data via the HTML renderer, whereby the client may display or print the representation of the current object in the recordset, e.g., as a completed invoice.
An extension to the present invention involves the use of multiple-page HTML. For example, if the data retrieved by the controls for an invoice is too large to display on a single invoice page, another HTML page, that is different from the first page of the invoice, would be automatically loaded as a template and the overflow data properly merged therewith. A page spanning control is placed on the page, and includes information that spans multiple pages. Once the template is loaded, the template data control iterates through the elements in the document. The template data control determines what is the last page in the document relative to the beginning of the document and relative to the page spanning control. When the Page Spanning Control is initialized, it dispatches a notification informing how many pages it spans, whereby using this data, the template data control determines how many pages the document has.
The template data control sets the current page to be the first page in the document. Each time the current page is changed (by the template Data Control on behalf of the client), the template data control iterates through the document elements, inspecting their custom properties to determines whether the elements should be shown or hidden, and also dispatches notifications informing the controls linked thereto that the current page has changed. The page spanning control uses these notifications to update itself to show the new page.
Other objects and advantages will become apparent from the following detailed description when taken in conjunction with the drawings, in which: